package logger

import (
	"go.uber.org/zap"
	"go.uber.org/zap/zapcore"
)

var (
	Log *zap.Logger
)

// InitLogger initializes a new zap logger.
// For development, it creates a human-friendly, colored console logger.
func InitLogger() {
	// Configure the logger
	config := zap.NewDevelopmentConfig()
	config.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder

	// Build the logger
	var err error
	Log, err = config.Build()
	if err != nil {
		panic("failed to initialize zap logger: " + err.Error())
	}
} 